package odgs.message.client;

import java.util.List;

import odgs.Connection;
import odgs.Contents;
import odgs.SelectGridNode;
import odgs.message.Message;
import odgs.message.MessageHandler;
import odgs.message.MessageProcessor;
import odgs.transaction.ContentsAddTransaction;

public class SelectNodeResponseHandler implements MessageHandler
{
	public void execute(MessageProcessor processor, Message msg, Connection con)
	{
		if(msg.getResult() < 0)
		{
			ContentsAddTransaction tran = (ContentsAddTransaction) msg.get("transaction");
			processor.getTransactionManager().error(msg.getResult(), tran);
		}
		else
		{
			List<SelectGridNode> nodes =  (List<SelectGridNode>) msg.get("nodes");
			processor.getTransactionManager().sendFile(nodes);
		}
	}
}
